function valid_decimal( Elem, ThSep, DecPoint, Dec)
{
	var gx_DecRegExp = new RegExp("^[ ]*([+-]?[0-9]*(\\" + ThSep + "[0-9]{3})*(\\" + DecPoint + "[0-9]*)?)?[ ]*$");
	if (gx_DecRegExp.test( Elem.value))
	{
		DecPointIndex = Elem.value.indexOf(DecPoint);
		if (DecPointIndex != -1)
			Elem.value = Elem.value.slice( 0, DecPointIndex + parseInt(Dec) + 1);
	}
	else
	{
	   	alert(GXBadNumMsg); 
   		Elem.focus();
	}
}

function valid_integer( Elem, ThSep)
{
	var gx_IntRegExp = new RegExp("^[ ]*([+-]?[0-9]*(\\" + ThSep + "[0-9]{3})*)?[ ]*$");
	if (! gx_IntRegExp.test( Elem.value))
	{ 
		alert(GXBadNumMsg); 
		Elem.focus();
	}
}

function GX_js_close()
{
	if (document.forms[0].sCallerURL.value != "")
		location.assign(document.forms[0].sCallerURL.value);
	else
		window.close();
}

function change_control( newValue, checkCtrl)
{
	if (checkCtrl.value != newValue && checkCtrl.type == "checkbox" )
	{
		if (checkCtrl.checked )
		   checkCtrl.checked = false;
		else
		   checkCtrl.checked = true;
	}
}

function gxonload()
{
	var LastActiveControl = window.document.activeElement;
	window.document.forms[0].reset();
	try
	{
		if (LastActiveControl)
		{
			LastActiveControl.focus();
			if (LastActiveControl.type == "text" || LastActiveControl.type == "file")
					LastActiveControl.select();
		}
	}
	catch(e) {}
}
